//
//  UINavigationBarExtension.swift
//  AnShiPai
//
//  Created by 马瑜 on 2017/7/7.
//  Copyright © 2017年 马瑜. All rights reserved.
//

import UIKit

public extension UINavigationBar {
    
    func getBottomLineView()->UIImageView? {
        return self.searchBottomLineWithView(self)
    }
    
    func searchBottomLineWithView(_ view: UIView) ->  UIImageView? {
        if view.isKind(of: UIImageView.self) && view.frame.size.height <= 1.0 {
            return view as? UIImageView
        }
        
        for view in view.subviews {
            let imageView = self.searchBottomLineWithView(view)
            if imageView != nil {
                return imageView
            }
        }
        return nil
    }
}
